package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	OrderNo  string  `json:"orderNo"`
	HouseId  int64   `json:"houseId"`
	UserId   int64   `json:"userId"`
	Quantity int64   `json:"quantity"`
	Price    float64 `json:"price"`
	State    int64   `json:"state"`
}

func (o *Order) UpdateState(orderNo string, state string) error {
	return DB.Debug().Model(&Order{}).Where("order_no = ?", orderNo).Update("state", state).Error
}
